﻿#region << 文件说明 >>
/*----------------------------------------------------------------
 * 命名空间：Vampirewal.Core.WebApi.Interfaces
 * 唯一标识：1bd0c44b-9ece-4bf2-ab72-b841922c5086
 * 文件名：IVampirewalIApiResultProvider
 * 
 * 创建者：杨程
 * 电子邮箱：235160615@qq.com
 * 创建时间：2023/10/8 9:22:26
 * 版本：V1.0.0
 * 描述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/
#endregion << 文件说明 >>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;


namespace Vampirewal.Core.WebApi;

/// <summary>
/// 全局返回值拦截
/// </summary>
public interface IVampirewalApiResultProvider
{
    /// <summary>
    /// 异常返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="exc"></param>
    /// <returns></returns>
    Task OnErrorResponse(HttpListenerContext context, VampirewalWebApiException exc);

    /// <summary>
    /// 成功返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="data"></param>
    /// <returns></returns>
    Task OnSuccessResponse(HttpListenerContext context, object data);

    ///// <summary>
    ///// 验证失败返回值
    ///// </summary>
    ///// <param name="context"></param>
    ///// <param name="metadata"></param>
    ///// <returns></returns>
    //IActionResult OnValidateFailed(ActionExecutingContext context, ValidationMetadata metadata);

    /// <summary>
    /// 拦截返回状态码
    /// </summary>
    /// <returns></returns>
    Task<string> OnResponseStatusCodes(int statusCode, bool succeeded = default, object data = default, object errorInfo = default);
}